1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.TreeViewColumn; 26 27 private import glib.ConstructionException; 28 private import glib.Str; 29 private import glib.c.functions; 30 private import gobject.ObjectG; 31 private import gobject.Signals; 32 private import gtk.BuildableIF; 33 private import gtk.BuildableT; 34 private import gtk.CellArea; 35 private import gtk.CellLayoutIF; 36 private import gtk.CellLayoutT; 37 private import gtk.CellRenderer; 38 private import gtk.TreeIter; 39 private import gtk.TreeModelIF; 40 private import gtk.Widget; 41 private import gtk.c.functions; 42 public import gtk.c.types; 43 private import std.algorithm; 44 45 46 /** 47 * A visible column in a [class@Gtk.TreeView] widget 48 * 49 * The `GtkTreeViewColumn` object represents a visible column in a `GtkTreeView` widget. 50 * It allows to set properties of the column header, and functions as a holding pen 51 * for the cell renderers which determine how the data in the column is displayed. 52 * 53 * Please refer to the [tree widget conceptual overview](section-tree-widget.html) 54 * for an overview of all the objects and data types related to the tree widget and 55 * how they work together, and to the [class@Gtk.TreeView] documentation for specifics 56 * about the CSS node structure for treeviews and their headers. 57 */ 58 public class TreeViewColumn : ObjectG, BuildableIF, CellLayoutIF 59 { 60 /** the main Gtk struct */ 61 protected GtkTreeViewColumn* gtkTreeViewColumn; 62 63 /** Get the main Gtk struct */ 64 public GtkTreeViewColumn* getTreeViewColumnStruct(bool transferOwnership = false) 65 { 66 if (transferOwnership) 67 ownedRef = false; 68 return gtkTreeViewColumn; 69 } 70 71 /** the main Gtk struct as a void* */ 72 protected override void* getStruct() 73 { 74 return cast(void*)gtkTreeViewColumn; 75 } 76 77 /** 78 * Sets our main struct and passes it to the parent class. 79 */ 80 public this (GtkTreeViewColumn* gtkTreeViewColumn, bool ownedRef = false) 81 { 82 this.gtkTreeViewColumn = gtkTreeViewColumn; 83 super(cast(GObject*)gtkTreeViewColumn, ownedRef); 84 } 85 86 // add the Buildable capabilities 87 mixin BuildableT!(GtkTreeViewColumn); 88 89 // add the CellLayout capabilities 90 mixin CellLayoutT!(GtkTreeViewColumn); 91 92 /** 93 * Creates a new Tree view column 94 * Params: 95 * header = th column header text 96 * renderer = the rederer for the column cells 97 * type = the type of data to be displayed (shouldn't this be on the renderer?) 98 * column = the column number 99 * Throws: ConstructionException GTK+ fails to create the object. 100 */ 101 //TODO: allow setting more attributes? 102 this(string header, CellRenderer renderer, string type, int column) 103 { 104 auto __p = gtk_tree_view_column_new_with_attributes( 105 Str.toStringz(header), 106 renderer.getCellRendererStruct(), 107 Str.toStringz(type), 108 column, 109 null); 110 111 if(__p is null) 112 { 113 throw new ConstructionException("null returned by gtk_tree_view_column_new_with_attributes"); 114 } 115 116 this(__p); 117 } 118 119 /** 120 */ 121 122 /** */ 123 public static GType getType() 124 { 125 return gtk_tree_view_column_get_type(); 126 } 127 128 /** 129 * Creates a new `GtkTreeViewColumn`. 130 * 131 * Returns: A newly created `GtkTreeViewColumn`. 132 * 133 * Throws: ConstructionException GTK+ fails to create the object. 134 */ 135 public this() 136 { 137 auto __p = gtk_tree_view_column_new(); 138 139 if(__p is null) 140 { 141 throw new ConstructionException("null returned by new"); 142 } 143 144 this(cast(GtkTreeViewColumn*) __p); 145 } 146 147 /** 148 * Creates a new `GtkTreeViewColumn` using @area to render its cells. 149 * 150 * Params: 151 * area = the `GtkCellArea` that the newly created column should use to layout cells. 152 * 153 * Returns: A newly created `GtkTreeViewColumn`. 154 * 155 * Throws: ConstructionException GTK+ fails to create the object. 156 */ 157 public this(CellArea area) 158 { 159 auto __p = gtk_tree_view_column_new_with_area((area is null) ? null : area.getCellAreaStruct()); 160 161 if(__p is null) 162 { 163 throw new ConstructionException("null returned by new_with_area"); 164 } 165 166 this(cast(GtkTreeViewColumn*) __p); 167 } 168 169 /** 170 * Adds an attribute mapping to the list in @tree_column. 171 * 172 * The @column is the 173 * column of the model to get a value from, and the @attribute is the 174 * parameter on @cell_renderer to be set from the value. So for example 175 * if column 2 of the model contains strings, you could have the 176 * “text” attribute of a `GtkCellRendererText` get its values from 177 * column 2. 178 * 179 * Params: 180 * cellRenderer = the `GtkCellRenderer` to set attributes on 181 * attribute = An attribute on the renderer 182 * column = The column position on the model to get the attribute from. 183 */ 184 public void addAttribute(CellRenderer cellRenderer, string attribute, int column) 185 { 186 gtk_tree_view_column_add_attribute(gtkTreeViewColumn, (cellRenderer is null) ? null : cellRenderer.getCellRendererStruct(), Str.toStringz(attribute), column); 187 } 188 189 /** 190 * Obtains the horizontal position and size of a cell in a column. 191 * 192 * If the cell is not found in the column, @start_pos and @width 193 * are not changed and %FALSE is returned. 194 * 195 * Params: 196 * cellRenderer = a `GtkCellRenderer` 197 * xOffset = return location for the horizontal 198 * position of @cell within @tree_column 199 * width = return location for the width of @cell 200 * 201 * Returns: %TRUE if @cell belongs to @tree_column 202 */ 203 public bool cellGetPosition(CellRenderer cellRenderer, out int xOffset, out int width) 204 { 205 return gtk_tree_view_column_cell_get_position(gtkTreeViewColumn, (cellRenderer is null) ? null : cellRenderer.getCellRendererStruct(), &xOffset, &width) != 0; 206 } 207 208 /** 209 * Obtains the width and height needed to render the column. This is used 210 * primarily by the `GtkTreeView`. 211 * 212 * Params: 213 * xOffset = location to return x offset of a cell relative to @cell_area 214 * yOffset = location to return y offset of a cell relative to @cell_area 215 * width = location to return width needed to render a cell 216 * height = location to return height needed to render a cell 217 */ 218 public void cellGetSize(out int xOffset, out int yOffset, out int width, out int height) 219 { 220 gtk_tree_view_column_cell_get_size(gtkTreeViewColumn, &xOffset, &yOffset, &width, &height); 221 } 222 223 /** 224 * Returns %TRUE if any of the cells packed into the @tree_column are visible. 225 * For this to be meaningful, you must first initialize the cells with 226 * gtk_tree_view_column_cell_set_cell_data() 227 * 228 * Returns: %TRUE, if any of the cells packed into the @tree_column are currently visible 229 */ 230 public bool cellIsVisible() 231 { 232 return gtk_tree_view_column_cell_is_visible(gtkTreeViewColumn) != 0; 233 } 234 235 /** 236 * Sets the cell renderer based on the @tree_model and @iter. That is, for 237 * every attribute mapping in @tree_column, it will get a value from the set 238 * column on the @iter, and use that value to set the attribute on the cell 239 * renderer. This is used primarily by the `GtkTreeView`. 240 * 241 * Params: 242 * treeModel = The `GtkTreeModel` to get the cell renderers attributes from. 243 * iter = The `GtkTreeIter` to get the cell renderer’s attributes from. 244 * isExpander = %TRUE, if the row has children 245 * isExpanded = %TRUE, if the row has visible children 246 */ 247 public void cellSetCellData(TreeModelIF treeModel, TreeIter iter, bool isExpander, bool isExpanded) 248 { 249 gtk_tree_view_column_cell_set_cell_data(gtkTreeViewColumn, (treeModel is null) ? null : treeModel.getTreeModelStruct(), (iter is null) ? null : iter.getTreeIterStruct(), isExpander, isExpanded); 250 } 251 252 /** 253 * Unsets all the mappings on all renderers on the @tree_column. 254 */ 255 public void clear() 256 { 257 gtk_tree_view_column_clear(gtkTreeViewColumn); 258 } 259 260 /** 261 * Clears all existing attributes previously set with 262 * gtk_tree_view_column_set_attributes(). 263 * 264 * Params: 265 * cellRenderer = a `GtkCellRenderer` to clear the attribute mapping on. 266 */ 267 public void clearAttributes(CellRenderer cellRenderer) 268 { 269 gtk_tree_view_column_clear_attributes(gtkTreeViewColumn, (cellRenderer is null) ? null : cellRenderer.getCellRendererStruct()); 270 } 271 272 /** 273 * Emits the “clicked” signal on the column. This function will only work if 274 * @tree_column is clickable. 275 */ 276 public void clicked() 277 { 278 gtk_tree_view_column_clicked(gtkTreeViewColumn); 279 } 280 281 /** 282 * Sets the current keyboard focus to be at @cell, if the column contains 283 * 2 or more editable and activatable cells. 284 * 285 * Params: 286 * cell = A `GtkCellRenderer` 287 */ 288 public void focusCell(CellRenderer cell) 289 { 290 gtk_tree_view_column_focus_cell(gtkTreeViewColumn, (cell is null) ? null : cell.getCellRendererStruct()); 291 } 292 293 /** 294 * Returns the current x alignment of @tree_column. This value can range 295 * between 0.0 and 1.0. 296 * 297 * Returns: The current alignent of @tree_column. 298 */ 299 public float getAlignment() 300 { 301 return gtk_tree_view_column_get_alignment(gtkTreeViewColumn); 302 } 303 304 /** 305 * Returns the button used in the treeview column header 306 * 307 * Returns: The button for the column header. 308 */ 309 public Widget getButton() 310 { 311 auto __p = gtk_tree_view_column_get_button(gtkTreeViewColumn); 312 313 if(__p is null) 314 { 315 return null; 316 } 317 318 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 319 } 320 321 /** 322 * Returns %TRUE if the user can click on the header for the column. 323 * 324 * Returns: %TRUE if user can click the column header. 325 */ 326 public bool getClickable() 327 { 328 return gtk_tree_view_column_get_clickable(gtkTreeViewColumn) != 0; 329 } 330 331 /** 332 * Returns %TRUE if the column expands to fill available space. 333 * 334 * Returns: %TRUE if the column expands to fill available space. 335 */ 336 public bool getExpand() 337 { 338 return gtk_tree_view_column_get_expand(gtkTreeViewColumn) != 0; 339 } 340 341 /** 342 * Gets the fixed width of the column. This may not be the actual displayed 343 * width of the column; for that, use gtk_tree_view_column_get_width(). 344 * 345 * Returns: The fixed width of the column. 346 */ 347 public int getFixedWidth() 348 { 349 return gtk_tree_view_column_get_fixed_width(gtkTreeViewColumn); 350 } 351 352 /** 353 * Returns the maximum width in pixels of the @tree_column, or -1 if no maximum 354 * width is set. 355 * 356 * Returns: The maximum width of the @tree_column. 357 */ 358 public int getMaxWidth() 359 { 360 return gtk_tree_view_column_get_max_width(gtkTreeViewColumn); 361 } 362 363 /** 364 * Returns the minimum width in pixels of the @tree_column, or -1 if no minimum 365 * width is set. 366 * 367 * Returns: The minimum width of the @tree_column. 368 */ 369 public int getMinWidth() 370 { 371 return gtk_tree_view_column_get_min_width(gtkTreeViewColumn); 372 } 373 374 /** 375 * Returns %TRUE if the @tree_column can be reordered by the user. 376 * 377 * Returns: %TRUE if the @tree_column can be reordered by the user. 378 */ 379 public bool getReorderable() 380 { 381 return gtk_tree_view_column_get_reorderable(gtkTreeViewColumn) != 0; 382 } 383 384 /** 385 * Returns %TRUE if the @tree_column can be resized by the end user. 386 * 387 * Returns: %TRUE, if the @tree_column can be resized. 388 */ 389 public bool getResizable() 390 { 391 return gtk_tree_view_column_get_resizable(gtkTreeViewColumn) != 0; 392 } 393 394 /** 395 * Returns the current type of @tree_column. 396 * 397 * Returns: The type of @tree_column. 398 */ 399 public GtkTreeViewColumnSizing getSizing() 400 { 401 return gtk_tree_view_column_get_sizing(gtkTreeViewColumn); 402 } 403 404 /** 405 * Gets the logical @sort_column_id that the model sorts on 406 * when this column is selected for sorting. 407 * 408 * See [method@Gtk.TreeViewColumn.set_sort_column_id]. 409 * 410 * Returns: the current @sort_column_id for this column, or -1 if 411 * this column can’t be used for sorting 412 */ 413 public int getSortColumnId() 414 { 415 return gtk_tree_view_column_get_sort_column_id(gtkTreeViewColumn); 416 } 417 418 /** 419 * Gets the value set by gtk_tree_view_column_set_sort_indicator(). 420 * 421 * Returns: whether the sort indicator arrow is displayed 422 */ 423 public bool getSortIndicator() 424 { 425 return gtk_tree_view_column_get_sort_indicator(gtkTreeViewColumn) != 0; 426 } 427 428 /** 429 * Gets the value set by gtk_tree_view_column_set_sort_order(). 430 * 431 * Returns: the sort order the sort indicator is indicating 432 */ 433 public GtkSortType getSortOrder() 434 { 435 return gtk_tree_view_column_get_sort_order(gtkTreeViewColumn); 436 } 437 438 /** 439 * Returns the spacing of @tree_column. 440 * 441 * Returns: the spacing of @tree_column. 442 */ 443 public int getSpacing() 444 { 445 return gtk_tree_view_column_get_spacing(gtkTreeViewColumn); 446 } 447 448 /** 449 * Returns the title of the widget. 450 * 451 * Returns: the title of the column. This string should not be 452 * modified or freed. 453 */ 454 public string getTitle() 455 { 456 return Str.toString(gtk_tree_view_column_get_title(gtkTreeViewColumn)); 457 } 458 459 /** 460 * Returns the `GtkTreeView` wherein @tree_column has been inserted. 461 * If @column is currently not inserted in any tree view, %NULL is 462 * returned. 463 * 464 * Returns: The tree view wherein @column 465 * has been inserted 466 */ 467 public Widget getTreeView() 468 { 469 auto __p = gtk_tree_view_column_get_tree_view(gtkTreeViewColumn); 470 471 if(__p is null) 472 { 473 return null; 474 } 475 476 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 477 } 478 479 /** 480 * Returns %TRUE if @tree_column is visible. 481 * 482 * Returns: whether the column is visible or not. If it is visible, then 483 * the tree will show the column. 484 */ 485 public bool getVisible() 486 { 487 return gtk_tree_view_column_get_visible(gtkTreeViewColumn) != 0; 488 } 489 490 /** 491 * Returns the `GtkWidget` in the button on the column header. 492 * 493 * If a custom widget has not been set then %NULL is returned. 494 * 495 * Returns: The `GtkWidget` in the column header 496 */ 497 public Widget getWidget() 498 { 499 auto __p = gtk_tree_view_column_get_widget(gtkTreeViewColumn); 500 501 if(__p is null) 502 { 503 return null; 504 } 505 506 return ObjectG.getDObject!(Widget)(cast(GtkWidget*) __p); 507 } 508 509 /** 510 * Returns the current size of @tree_column in pixels. 511 * 512 * Returns: The current width of @tree_column. 513 */ 514 public int getWidth() 515 { 516 return gtk_tree_view_column_get_width(gtkTreeViewColumn); 517 } 518 519 /** 520 * Returns the current X offset of @tree_column in pixels. 521 * 522 * Returns: The current X offset of @tree_column. 523 */ 524 public int getXOffset() 525 { 526 return gtk_tree_view_column_get_x_offset(gtkTreeViewColumn); 527 } 528 529 /** 530 * Adds the @cell to end of the column. If @expand is %FALSE, then the @cell 531 * is allocated no more space than it needs. Any unused space is divided 532 * evenly between cells for which @expand is %TRUE. 533 * 534 * Params: 535 * cell = The `GtkCellRenderer` 536 * expand = %TRUE if @cell is to be given extra space allocated to @tree_column. 537 */ 538 public void packEnd(CellRenderer cell, bool expand) 539 { 540 gtk_tree_view_column_pack_end(gtkTreeViewColumn, (cell is null) ? null : cell.getCellRendererStruct(), expand); 541 } 542 543 /** 544 * Packs the @cell into the beginning of the column. If @expand is %FALSE, then 545 * the @cell is allocated no more space than it needs. Any unused space is divided 546 * evenly between cells for which @expand is %TRUE. 547 * 548 * Params: 549 * cell = The `GtkCellRenderer` 550 * expand = %TRUE if @cell is to be given extra space allocated to @tree_column. 551 */ 552 public void packStart(CellRenderer cell, bool expand) 553 { 554 gtk_tree_view_column_pack_start(gtkTreeViewColumn, (cell is null) ? null : cell.getCellRendererStruct(), expand); 555 } 556 557 /** 558 * Flags the column, and the cell renderers added to this column, to have 559 * their sizes renegotiated. 560 */ 561 public void queueResize() 562 { 563 gtk_tree_view_column_queue_resize(gtkTreeViewColumn); 564 } 565 566 /** 567 * Sets the alignment of the title or custom widget inside the column header. 568 * The alignment determines its location inside the button -- 0.0 for left, 0.5 569 * for center, 1.0 for right. 570 * 571 * Params: 572 * xalign = The alignment, which is between [0.0 and 1.0] inclusive. 573 */ 574 public void setAlignment(float xalign) 575 { 576 gtk_tree_view_column_set_alignment(gtkTreeViewColumn, xalign); 577 } 578 579 /** 580 * Sets the `GtkTreeCellDataFunc` to use for the column. 581 * 582 * This 583 * function is used instead of the standard attributes mapping for 584 * setting the column value, and should set the value of @tree_column's 585 * cell renderer as appropriate. @func may be %NULL to remove an 586 * older one. 587 * 588 * Params: 589 * cellRenderer = A `GtkCellRenderer` 590 * func = The `GtkTreeCellDataFunc` to use. 591 * funcData = The user data for @func. 592 * destroy = The destroy notification for @func_data 593 */ 594 public void setCellDataFunc(CellRenderer cellRenderer, GtkTreeCellDataFunc func, void* funcData, GDestroyNotify destroy) 595 { 596 gtk_tree_view_column_set_cell_data_func(gtkTreeViewColumn, (cellRenderer is null) ? null : cellRenderer.getCellRendererStruct(), func, funcData, destroy); 597 } 598 599 /** 600 * Sets the header to be active if @clickable is %TRUE. When the header is 601 * active, then it can take keyboard focus, and can be clicked. 602 * 603 * Params: 604 * clickable = %TRUE if the header is active. 605 */ 606 public void setClickable(bool clickable) 607 { 608 gtk_tree_view_column_set_clickable(gtkTreeViewColumn, clickable); 609 } 610 611 /** 612 * Sets the column to take available extra space. This space is shared equally 613 * amongst all columns that have the expand set to %TRUE. If no column has this 614 * option set, then the last column gets all extra space. By default, every 615 * column is created with this %FALSE. 616 * 617 * Along with “fixed-width”, the “expand” property changes when the column is 618 * resized by the user. 619 * 620 * Params: 621 * expand = %TRUE if the column should expand to fill available space. 622 */ 623 public void setExpand(bool expand) 624 { 625 gtk_tree_view_column_set_expand(gtkTreeViewColumn, expand); 626 } 627 628 /** 629 * If @fixed_width is not -1, sets the fixed width of @tree_column; otherwise 630 * unsets it. The effective value of @fixed_width is clamped between the 631 * minimum and maximum width of the column; however, the value stored in the 632 * “fixed-width” property is not clamped. If the column sizing is 633 * %GTK_TREE_VIEW_COLUMN_GROW_ONLY or %GTK_TREE_VIEW_COLUMN_AUTOSIZE, setting 634 * a fixed width overrides the automatically calculated width. Note that 635 * @fixed_width is only a hint to GTK; the width actually allocated to the 636 * column may be greater or less than requested. 637 * 638 * Along with “expand”, the “fixed-width” property changes when the column is 639 * resized by the user. 640 * 641 * Params: 642 * fixedWidth = The new fixed width, in pixels, or -1. 643 */ 644 public void setFixedWidth(int fixedWidth) 645 { 646 gtk_tree_view_column_set_fixed_width(gtkTreeViewColumn, fixedWidth); 647 } 648 649 /** 650 * Sets the maximum width of the @tree_column. If @max_width is -1, then the 651 * maximum width is unset. Note, the column can actually be wider than max 652 * width if it’s the last column in a view. In this case, the column expands to 653 * fill any extra space. 654 * 655 * Params: 656 * maxWidth = The maximum width of the column in pixels, or -1. 657 */ 658 public void setMaxWidth(int maxWidth) 659 { 660 gtk_tree_view_column_set_max_width(gtkTreeViewColumn, maxWidth); 661 } 662 663 /** 664 * Sets the minimum width of the @tree_column. If @min_width is -1, then the 665 * minimum width is unset. 666 * 667 * Params: 668 * minWidth = The minimum width of the column in pixels, or -1. 669 */ 670 public void setMinWidth(int minWidth) 671 { 672 gtk_tree_view_column_set_min_width(gtkTreeViewColumn, minWidth); 673 } 674 675 /** 676 * If @reorderable is %TRUE, then the column can be reordered by the end user 677 * dragging the header. 678 * 679 * Params: 680 * reorderable = %TRUE, if the column can be reordered. 681 */ 682 public void setReorderable(bool reorderable) 683 { 684 gtk_tree_view_column_set_reorderable(gtkTreeViewColumn, reorderable); 685 } 686 687 /** 688 * If @resizable is %TRUE, then the user can explicitly resize the column by 689 * grabbing the outer edge of the column button. 690 * 691 * If resizable is %TRUE and 692 * sizing mode of the column is %GTK_TREE_VIEW_COLUMN_AUTOSIZE, then the sizing 693 * mode is changed to %GTK_TREE_VIEW_COLUMN_GROW_ONLY. 694 * 695 * Params: 696 * resizable = %TRUE, if the column can be resized 697 */ 698 public void setResizable(bool resizable) 699 { 700 gtk_tree_view_column_set_resizable(gtkTreeViewColumn, resizable); 701 } 702 703 /** 704 * Sets the growth behavior of @tree_column to @type. 705 * 706 * Params: 707 * type = The `GtkTreeViewColumn`Sizing. 708 */ 709 public void setSizing(GtkTreeViewColumnSizing type) 710 { 711 gtk_tree_view_column_set_sizing(gtkTreeViewColumn, type); 712 } 713 714 /** 715 * Sets the logical @sort_column_id that this column sorts on when this column 716 * is selected for sorting. Doing so makes the column header clickable. 717 * 718 * Params: 719 * sortColumnId = The @sort_column_id of the model to sort on. 720 */ 721 public void setSortColumnId(int sortColumnId) 722 { 723 gtk_tree_view_column_set_sort_column_id(gtkTreeViewColumn, sortColumnId); 724 } 725 726 /** 727 * Call this function with a @setting of %TRUE to display an arrow in 728 * the header button indicating the column is sorted. Call 729 * gtk_tree_view_column_set_sort_order() to change the direction of 730 * the arrow. 731 * 732 * Params: 733 * setting = %TRUE to display an indicator that the column is sorted 734 */ 735 public void setSortIndicator(bool setting) 736 { 737 gtk_tree_view_column_set_sort_indicator(gtkTreeViewColumn, setting); 738 } 739 740 /** 741 * Changes the appearance of the sort indicator. 742 * 743 * This does not actually sort the model. Use 744 * gtk_tree_view_column_set_sort_column_id() if you want automatic sorting 745 * support. This function is primarily for custom sorting behavior, and should 746 * be used in conjunction with gtk_tree_sortable_set_sort_column_id() to do 747 * that. For custom models, the mechanism will vary. 748 * 749 * The sort indicator changes direction to indicate normal sort or reverse sort. 750 * Note that you must have the sort indicator enabled to see anything when 751 * calling this function; see gtk_tree_view_column_set_sort_indicator(). 752 * 753 * Params: 754 * order = sort order that the sort indicator should indicate 755 */ 756 public void setSortOrder(GtkSortType order) 757 { 758 gtk_tree_view_column_set_sort_order(gtkTreeViewColumn, order); 759 } 760 761 /** 762 * Sets the spacing field of @tree_column, which is the number of pixels to 763 * place between cell renderers packed into it. 764 * 765 * Params: 766 * spacing = distance between cell renderers in pixels. 767 */ 768 public void setSpacing(int spacing) 769 { 770 gtk_tree_view_column_set_spacing(gtkTreeViewColumn, spacing); 771 } 772 773 /** 774 * Sets the title of the @tree_column. If a custom widget has been set, then 775 * this value is ignored. 776 * 777 * Params: 778 * title = The title of the @tree_column. 779 */ 780 public void setTitle(string title) 781 { 782 gtk_tree_view_column_set_title(gtkTreeViewColumn, Str.toStringz(title)); 783 } 784 785 /** 786 * Sets the visibility of @tree_column. 787 * 788 * Params: 789 * visible = %TRUE if the @tree_column is visible. 790 */ 791 public void setVisible(bool visible) 792 { 793 gtk_tree_view_column_set_visible(gtkTreeViewColumn, visible); 794 } 795 796 /** 797 * Sets the widget in the header to be @widget. If widget is %NULL, then the 798 * header button is set with a `GtkLabel` set to the title of @tree_column. 799 * 800 * Params: 801 * widget = A child `GtkWidget` 802 */ 803 public void setWidget(Widget widget) 804 { 805 gtk_tree_view_column_set_widget(gtkTreeViewColumn, (widget is null) ? null : widget.getWidgetStruct()); 806 } 807 808 /** 809 * Emitted when the column's header has been clicked. 810 */ 811 gulong addOnClicked(void delegate(TreeViewColumn) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 812 { 813 return Signals.connect(this, "clicked", dlg, connectFlags ^ ConnectFlags.SWAPPED); 814 } 815 }